package mathMethod;

import com.sun.scenario.animation.shared.ClipEnvelope;

public class Rotate {

    /**
     * LeetCode T48 旋转图像
     * @param args
     */
    public static void main(String[] args) {

    }

    public void rotate(int[][] matrix) {
        //首先，关于对角线对称
        for (int i = 1; i < matrix.length; i++){
            for (int j = 0; j < i; j++){
                int tmp = matrix[i][j];
                matrix[i][j] = matrix[j][i];
                matrix[j][i] = tmp;
            }
        }
        for (int i = 0; i < matrix.length; i++){
            int len = matrix[i].length;
            for (int j = 0; j < len/2; j++){
                int tmp = matrix[i][j];
                matrix[i][j] = matrix[i][len - 1 - j];
                matrix[i][len - 1 - j] = tmp;
            }
        }
    }

}
